Click here to Skip to main content
15,914,419 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi all,

I have a registration page which contains a password field.But i want the password field must contains all the following below as
1)lower case letter
2)one upper case letter
3)special character
4)one number



Thanks
Posted

Why? Haven't you read this[^]?

Anyway, RegEx[^] will do.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 8-Sep-11 1:10am    
Exactly. My 5.
--SA
Like Firo said Regex can do that for you, I've put one together for you
(?=^.{8})(?=.*[a-z])(?=.*[A-Z])(?=.*[^\w\d])(?=.*\d).*$

You can find plenty more if you Google for it.

There is however more to a strong password than the 4 points you posted.
1) Length (included in the regex a I gave you; min. length 8)
2) Sequential letters/digits (e.g. abc, 12345) this makes the password less strong
3) Case insensitive repeated characters (e.g. XxXXxx) this makes the password less strong
4) The list here goes on, with what makes a password more or less strong. I wont type it all out here though as I believe you have the info you want.
 
Share this answer
 
v3
Comments
[no name] 8-Sep-11 0:19am    
Good answer my 5!!!
Simon Bang Terkildsen 8-Sep-11 1:16am    
Thank you
Sergey Alexandrovich Kryukov 8-Sep-11 1:13am    
I disagree with item #3. If you think about it, the difference is mostly psychological. Overall, my 5.
--SA
Simon Bang Terkildsen 8-Sep-11 1:37am    
Thank you, about #3 AAaaaa@1 as safe as Hjay#1@Q, if you watch someone entering those two passwords it'll be easier for you to catch and remember the first one. Which is the reason I use #3 when calculating password strength.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900